package com.bit.blog.pojo.response;

import com.bit.blog.enums.ResultCodeEnum;
import lombok.Data;

import java.util.Objects;
@Data
public class Result {
    private ResultCodeEnum code;//业务状态码,非http状态码；
    private String errMsg;//错误信息；
    private Object data;//返回数据；
    public static Result success(Object data){
        Result result=new Result();
        result.setCode(ResultCodeEnum.SUCCESS);
        result.setData(data);
        return result;
    }
    public static Result fail(String  errMsg){
        Result result=new Result();
        result.setCode(ResultCodeEnum.FAIL);
        result.setErrMsg(errMsg);
        return result;
    }
    public static Result fail(String  errMsg,String data){
        Result result=new Result();
        result.setCode(ResultCodeEnum.FAIL);
        result.setErrMsg(errMsg);
        result.setData(data);
        return result;
    }

}
